#!/bin/sh

# 创建配置文件目录
if [ ! -d "~/configs/" ];then
mkdir ~/configs
fi
cd ~/configs

# app_names 即应用程序名称（参考上面的表格），根据需要删除不打算部署的项
app_names=("mycat" "fs" "basedata" "proxy" "gateway" "storage_bigdata" "storage_general" "attachment")

# 下载配置文件
for name in $app_names
do
    mkdir $name
    cd $name
    if [ $name == "mycat" ]
    then
        # 下载mycat配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/mycat/server.xml
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/mycat/schema.xml
    elif [ $name == "fs" ]
    then
         # 下载文件服务器配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/fs/application.properties
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/fs/log4j2.xml
    elif [ $name == "basedata" ]
    then
         # 下载基础数据webapi配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/basedata/AppConfig.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/basedata/NLog.Config
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/basedata/host.json
    elif [ $name == "proxy" ]
    then
         # 下载网关集群代理配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/proxy/hosting.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/proxy/AppConfig.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/proxy/%20NLog.Config
    elif [ $name == "gateway" ]
    then
         # 下载网关主程序配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/gateway/gateway.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/gateway/NLog.Config
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/gateway/host.json
    elif [ $name == "storage_bigdata" ]
    then
         # 下载入库服务（大数据）配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/AppConfig.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/NLog.Config
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/notity.json
    elif [ $name == "storage_general" ]
    then
         # 下载入库服务（常规数据）配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/AppConfig.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/NLog.Config
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/storage/notity.json
    elif [ $name == "attachment" ]
    then
         # 下载苏标附件服务器配置文件
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/attachment/AppConfig.json
        wget https://gitee.com/cvnavi1/gateway/blob/master/configs/attachment/NLog.Config
    else
        echo "没找到对应的应用程序"
    fi
done